Imports System.drawing

Namespace Overlay
    Friend Class RestrictedAccess
        Inherits Chart

        Public Sub New( _
            ByVal iWidth As Integer, _
            ByVal iHeight As Integer)

            MyBase.New(iWidth, iHeight)
        End Sub

        Public Overrides Sub DrawChart(ByVal g As System.Drawing.Graphics)
            Dim sMessage1 As String = "This overlay type available in registered component only."
            Dim sMessage2 As String = "To register, please visit www.jlion.com"

            moChartDimensions.DrawBackground(g)

            Dim oFont As New System.Drawing.Font("Arial", 14, FontStyle.Bold)
            Dim oColor As Color = Color.FromArgb(150, Color.Green.R, Color.Green.G, Color.Green.B)

            Dim oSize As SizeF = g.MeasureString(sMessage1, oFont)

            Dim iX As Integer = MyBase.ChartDimensions.OuterX + (MyBase.ChartDimensions.OuterWidth - oSize.Width) / 2
            Dim iY As Integer = MyBase.ChartDimensions.OuterY + (MyBase.ChartDimensions.OuterHeight - oSize.Height) / 2

            g.DrawString(sMessage1, oFont, New SolidBrush(oColor), iX, iY)

            oSize = g.MeasureString(sMessage2, oFont)
            iX = MyBase.ChartDimensions.OuterX + (MyBase.ChartDimensions.OuterWidth - oSize.Width) / 2

            g.DrawString(sMessage2, oFont, New SolidBrush(oColor), iX, iY + oSize.Height * 1.5)
        End Sub
    End Class
End Namespace